/*
 * @Description: 
 * @Author: Leequik
 * @Date: 2025-07-07 10:50:28
 * @LastEditTime: 2025-07-07 11:08:11
 * @LastEditors: Leequik
 */
import   mitt from 'mitt';

//调用mitt得到emitter,emitter能绑定事件和触发事件
const emitter = mitt();


/*
//绑定事件
emitter.on('test', () => {
    console.log('test被调了');
});


emitter.on('change', (data) => {
    console.log(data,'change被调用了');
});

//触发事件

setInterval(() => {
    //触发
    emitter.emit('test');
    emitter.emit('change');
}, 1000);

setTimeout(() => {
    //解绑
    emitter.off('change');
    
    //解绑所有
    emitter.all.clear();
}, 2000);
*/


//任意组件通信，事件




export default emitter;